package com.yc.cloudvideo.sp_store.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yc.cloudvideo.entity.User;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author LYYT
 * @since 2022-08-03
 */
public interface UserMapper extends BaseMapper<User> {
    //不查密码
    @Select("select uid,head,nick_name,sign,email,is_boy,age,reg_time,vip from user where uid=#{uid}")
    User selectUserByUid(int uid);

    //根据cid查询出当前仓库的贡献者信息
    @Select("SELECT\n" +
            "	u.*\n" +
            "FROM\n" +
            "	store_file s\n" +
            "JOIN file f ON s.fid = f.fid\n" +
            "JOIN USER u ON u.uid = f.uid\n" +
            "WHERE\n" +
            "	cid = #{cid}\n" +
            "GROUP BY\n" +
            "	f.uid")
    List<User> selectUserGByCid(int cid);

}
